<!DOCTYPE html>
<html>
<head>
	<title>扫描记录</title>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
	<meta name="format-detection" content="telephone=no"/> <!--禁止数字串在ok手机中被识别成电话号码-->
	<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="__PUBLIC__/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>
	<style type="text/css">
		.table th, .table td { 
			text-align: center; 
			vertical-align: middle !important;
		}
		#title_scan span{text-align: center; }
	.pay{overflow:hidden;}
	.pay dl dt{padding: 5px;text-align: center;}
	.pay dl dt label{display:block;color:#C1D9F7}
	.pay dl dt strong{padding:5px 0 0;font-size: 1.5em;display: block;color:#000;font-weight: 500;}
	</style>
</head>
<body class="pay">
	<dl>
		<dt><strong>扫码点检记录</strong></dt>
	</dl>
	<div class="page-content">
		<div class="container-fluid">
			
			<div class="row-fluid">
				<div class="span12"> 
					<table class="table table-striped table-bordered table-condensed" id="logtable">
						<caption style="text-align: left;">设备：爬虫板</caption>
			            <tr>
			                <th rowspan="2">编号</th>
			                <th rowspan="2">设备情况</th>
			                <th colspan="4">种类</th>
			                <th rowspan="2">备注</th>
			            </tr>
			            <tr>
			                <th>蜚蠊</th>
			                <th>蜘蛛</th>
			                <th>壁虎</th>
			                <th>其他</th>
			            </tr>
			            <volist name="list" id="vo">
				            <tr>
				                <td>{$vo.device_id}</td>
				                <td>{$vo.status}</td>
				                <td>{$vo.zhanglang}</td>
				                <td>{$vo.zhizhu}</td>
				                <td>{$vo.bihu}</td>
				                <td>{$vo.other}</td>
				                <td>无</td>
				            </tr>
				        </volist>
				        
				       <script id="script-model" type="text/x-dot-template">
							{{ for (var i = 0; i < it.length; i++){ }}
								<tr>
					                <td>{{=it[i].device_id}}</td>
					                <td>{{=it[i].status}}</td>
					                <td>{{=it[i].zhanglang}}</td>
					                <td>{{=it[i].zhizhu}}</td>
					                <td>{{=it[i].bihu}}</td>
					                <td>{{=it[i].other}}</td>
					                <td>无</td>
					            </tr>
							{{ } }}
							</script> 
					</table>
				<div id="yemx" class="bill-list" align="center"><if condition='$list eq null'>没有数据<else />向上拖动加载更多……</if></div>
				</div>
			</div>
		</div>
	</div>
<script src="__PUBLIC__/js/jquery-1.10.1.min.js" type="text/javascript"></script>
<!-- <script src="__PUBLIC__/js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script> -->
<script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
<script src="__PUBLIC__/js/doT.min.js"></script>
<script type="text/javascript">
   var i=1;
   var bool=true
   $(window).scroll( function(){
          if (!bool) return false;
            var scrollTop = 0;
            var clientHeight = 0;
            var scrollHeight = 0;
            var replaceAppNo=$("input[name='replaceAppNo']" ).val();
            if (document.documentElement && document.documentElement.scrollTop) {
                scrollTop = document.documentElement.scrollTop;
            } else if (document.body) {
                scrollTop = document.body.scrollTop;
            }
            if (document.body.clientHeight && document.documentElement.clientHeight) {
                clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight;
            } else {
                clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight;
            }
            scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
            if (scrollTop + clientHeight == scrollHeight) {
                      //do something
                      var index = layer.load(1, {
			              shade: [0.5,'#fff'] //0.1透明度的白色背景
			            });
                      i++;
                      $.ajax({
                        url:"{:U('Reptile/scan_log')}",
                        type:"post",
                        data:{'page':i},
                        success:function(data){
                          if (data!="") {
                             layer.close(index);
                             $('#logtable').append(doT.template($('#script-model').text())(data));
                            }else{
                               $("#yemx").addClass('disabled').text("全部数据");
                               layer.close(index);
                                   bool=false;
                            }
                        }
                      })
                }
    });

  //json长度获取
  function getLength(json) {
      var Length = 0;
      for (var item in json) {
        Length++;
      }
      return Length;
    }
    function func_date(time){
          // return "aa";
          var date=new Date(parseInt(time)*1000);
          var year=date.getFullYear();  // 获取完整的年份(4位,1970)
          var month=date.getMonth()+1;  // 获取月份(0-11,0代表1月,用的时候记得加上1)
          var day=date.getDate();    //获取日
          return year+"-"+month+"-"+day;
    }
</script>
</body>
</html>